from flask import Flask
from flask_cors import CORS
import os
from app.api.nav_routes import nav_bp
from app.api.form_routes import form_bp

app = Flask(__name__)
CORS(app)  # 启用CORS支持

# 注册路由
app.register_blueprint(nav_bp, url_prefix='/api/nav')
app.register_blueprint(form_bp, url_prefix='/api/form')

# 确保数据目录存在
os.makedirs('data/forms', exist_ok=True)
os.makedirs('data/dashboards', exist_ok=True)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000, debug=True) 